<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./../jquery-1.12.4.js"></script>
    <script>
        var arr = [1, 3, 5, 7, 9];
        var obj = { 0: 1, 1: 3, 2: 5, 3: 7, 4: 9, length: 5 };
        // 利用原生JS的map方法遍历
        /* arr.map(function (value, index, array) {
            console.log(value, index, array);
        })
        obj.map(function (value, index, array) {
            console.log(value, index, array);
        }) */


        /* $.map(arr, function (value, index) {
            console.log(index, value);
        }) 
        console.log('---------');
        $.map(obj, function (value, index) {
            console.log(index, value);
        })
        */


        var res1 = $.each(obj, function (index, value) {
            return value + index;
        })
        var res2 = $.map(obj, function (value, index) {
            return value + index;
        })
        console.log(res1);
        console.log('------------');
        console.log(res2);
    </script>
</head>

<body>

</body>

</html>